diff options
Diffstat (limited to 'frontend/src/pages/raw/[hash].js')
| -rw-r--r-- | frontend/src/pages/raw/[hash].js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/frontend/src/pages/raw/[hash].js b/frontend/src/pages/raw/[hash].js new file mode 100644 index 0000000..d0a66a7 --- /dev/null +++ b/frontend/src/pages/raw/[hash].js @@ -0,0 +1,24 @@ +import React from 'react'; +import resolvePaste from "../../http/useFetchPaste"; +import {CodeLike} from "../../components/Common/mixins"; +import styled from 'styled-components' + +const RawText = styled.pre` + ${CodeLike} + padding: 0 1em; +` + +export async function getServerSideProps(ctx) { + const data = await resolvePaste(ctx.params.hash) + + // Pass data to the page via props + return { props: { ...data } } +} + +const Raw = ({error, data}) => { + return <RawText> + {data?.content || error} + </RawText> +} + +export default Raw
\ No newline at end of file |